package com.huaxinkai.mobile.util.wechatUtil;

import java.util.Arrays;

import com.huaxinkai.mobile.util.common.Sha1Util;

public class WechatCheck {
	
	public static boolean checkSignatrue(String signature, String timestamp, String nonce){
		String arr[] = new String[]{WechatConfig.WECHAT_TOKEN, timestamp, nonce};
		Arrays.sort(arr);
		
		StringBuffer content = new StringBuffer();
		for (String str : arr) {
			content.append(str);
		}
		
		//SHA1加密
		String sha1 = Sha1Util.getSha1(content.toString());
		boolean b = sha1.equals(signature);
		System.out.println("验证结果："+b);
		return b;
	} 
	
}
